package ar.edu.utn.frba.disenio.aterrizar.ui.arena;

import org.uqbar.arena.actions.MessageSend;
import org.uqbar.arena.layout.HorizontalLayout;
import org.uqbar.arena.layout.VerticalLayout;
import org.uqbar.arena.widgets.Button;
import org.uqbar.arena.widgets.Label;
import org.uqbar.arena.widgets.Panel;
import org.uqbar.arena.windows.WindowOwner;
import ar.edu.utn.frba.disenio.aterrizar.usuario.UsuarioEstandar;

public class HomeWindow extends BasicaWindow<UsuarioEstandar> {
	
	public HomeWindow(WindowOwner owner, UsuarioEstandar usuario) {
		super(owner, usuario);
		this.setMensaje("Hola ");
	}
	
	@Override
	public void createContents(Panel mainPanel) {
		super.createContents(mainPanel);
		mainPanel.setLayout(new VerticalLayout());
		
		Panel aPanel = new Panel(mainPanel);
		aPanel.setLayout(new HorizontalLayout());
		new Label(aPanel).setText("¿Qué desea hacer?");
		this.actionPanel(mainPanel);		
	}
		
	public void actionPanel(Panel mainPanel) {
	Panel aPanel = new Panel(mainPanel);
	aPanel.setLayout(new HorizontalLayout());
	new Button(aPanel)//
	.setCaption("Ver Compras")
	.onClick(new MessageSend(this, "mostrarCompras"));
	
	new Button(aPanel).//
	setCaption("Ver Reservas")
	.onClick(new MessageSend(this, "mostrarReservas"));
	
	new Button(aPanel)//
	.setCaption("Buscar Asientos")
	.onClick(new MessageSend(this, "abrirBusqueda"));
	}
	
	public void mostrarCompras() {
		new MostrarComprasWindow(this, this.getModelObject()).open();
	}
	
	public void mostrarReservas() {
		new MostrarReservasWindow(this, this.getModelObject()).open();
	}
	
	public void abrirBusqueda() {
		new BuscadorWindow(this, new BuscadorAsientos(this.getModelObject())).open();
	}

}
